<!DOCTYPE html>
<html>
<head lang="en">
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width,initial-scale=1,maximum-scale=1,minimum-scale=0,user-scalable=0">
[#include "/wap/include/static.html"]
    <link rel="stylesheet" href="${path}/resources/wap/css/logIn/register.css"/>
</head>
<body>
<!--头部-->
<header>
    <div class="left">
        <img id="goBack" src="${path}/resources/wap/img/me/blank.png">
    </div>
    <div class="center" onclick="window.location.href='/wap/member/common/login'">
       登录
    </div>
</header>
<form class="layui-form">
<!--输入框-->
<div id="matter">
    <div class="matter-option">
        <label class="tel" for="tel"><img src="${path}/resources/wap/img/logIn/tel.png" alt="图片"/></label><input id="tel" name="mobile" placeholder="请输入你的手机号">
    </div>
    <div class="matter-option">
        <label class="psd" for="psd"><img src="${path}/resources/wap/img/logIn/psd.png" alt="图片"/></label><input type="password" id="pass1" name="pass1" placeholder="请输入登陆密码：6-12位字母和数字">
    </div>


    <div class="matter-option">
        <label  class="psd2" for="psd2"><img src="${path}/resources/wap/img/logIn/psd.png" alt="图片"/></label><input type="password" id="pass2" name="pass2"  placeholder="请确认登陆密码：6-12位字母和数字">
    </div>


    <div class="matter-option">
        <label for="tel2" class="mans"><img src="${path}/resources/wap/img/logIn/mans.png" alt="图片"/></label><input   id="inviter" name="inviter" placeholder="推荐人手机号(选填)" value="${phone}">
    </div>
</div>
<!--按钮-->
<div class="button">
    <button lay-submit lay-filter="MainForm">注册</button>
</div>
    </form>
<!--协议-->
<div class="xie">
    <span>注册即表示你已经同意</span><span>《用户注册协议》</span>
</div>

</body>
<script>
    layui.use(['form','layer'], function(){
        var form = layui.form(), $=layui.jquery, layer = layui.layer;
        form.on('submit(MainForm)', function(data){

            var pass1 = $("#pass1").val();
            var pass2 = $("#pass2").val();
            if (pass1 == "" || pass1.length < 6) {
                layer.msg("密码长度不正确");
                return;
            }
            if (pass1 != pass2) {
                layer.msg("两次密码输入不一致！");
                return;
            }
            var index = layer.load();
            ajax({
                url:"${path}/regist_step1",
                data: data.field,
                type:"POST",
                dataType:"json",
                success: function(result){


                    if(result.type == "success"){
                        layer.msg(result.content,function() {
                            window.location.href = "${path}/wap/member/";
                        });

                    }else{
                        layer.msg(result.content);
                    }
                    layer.close(index);
                },
                complete:function(){
                    layer.close(index);
                }
            });
            return false;
        });
    });

</script>
</html>